<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function notice(){
            Notification.requestPermission(function() {
                if(Notification.permission === 'granted') {
                    // 用户点击了允许
                    let n = new Notification('你好', {
                        body: '美女图片!',
                        icon: 'https://tfs.alipayobjects.com/images/partner/TB11c6Ec4eJDuNjHvSWXXaKiXXa'
                    });
                    setTimeout(() => {
                        n.close();
                    }, 10000);
                    n.onclick = function(e) {
                        window.open("http://test-admin.suhuishou.com")
                        console.log(1, e);
                    };
                    n.onerror = function(e) {
                        console.log(2, e);
                    };
                    n.onshow = function(e) {
                        console.log(3, e);
                    };
                    n.onclose = function(e) {
                        console.log(4, e);
                    }
                }else if(Notification.permission === 'denied') {
                    // 用户点击了拒绝
                }else {
                    // 用户没有做决定
                }
            })
        }
    </script>
</head>
<body>
    <a href="javascript:notice()">notice</a>
</body>
</html>
